package org.jjche.demo.modules.student.transform.classes;

import org.jjche.common.transformer.ISimpleTransformer;
import org.springframework.lang.NonNull;
import org.springframework.stereotype.Component;

import java.util.Optional;

/**
 * 班级阶段转换器
 * <p>
 *
 * @author R
 * @since 2022-9-29
 */
@Component
public class ClassTransformer implements ISimpleTransformer<Long> {

    @Override
    public String transform(@NonNull Long classId) {
        String className = null;
        if (classId != null) {
            className = "三年" + classId + "班";// 实际情况下应查询db
        }
        return Optional.ofNullable(className).orElse(String.valueOf(classId));
    }
}
